﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using i4pro_gruppe_d.ControllerCommunication;
using i4pro_gruppe_d.RobotCommunication;
using i4pro_gruppe_d.Types;

namespace i4pro_gruppe_d.SimulatorAdaptor
{
	public class ConcreteSimulatorAdaptor : IControllerCommunication
	{
		private readonly Simulator _simulator = Simulator.Instance;

		public bool init(ushort mode)
        {
        	return _simulator.Init(mode);
        }
		public bool home(char axis)
        {
        	return _simulator.Home();
        }
		public bool control(char axis, bool status)
        {
        	return _simulator.Control(axis, status);
        }
		public bool moveTo(string vectorName1, short pointNumber1, string vectorname2, short pointNumber2)
		{
			return _simulator.MoveTo(vectorName1, pointNumber1, vectorname2, pointNumber2);
		}
		public bool getCurrentPos(ref Vector pos)
		{
			return _simulator.GetCurrentPos(ref pos);
		}
		public bool GetMotionStatus()
		{
			// Allows the arm to make a new move.
			return true;
		}
		public bool openGripper()
		{
			return _simulator.OpenGripper();
		}
		public bool closeGripper()
		{
			return _simulator.CloseGripper();
		}
		public bool getGripperWidth(ref short width)
		{
			return _simulator.GetGripperWidth(ref width);
		}
		public bool activateLightsensor()
		{
			return _simulator.ActivateLightSensor();
		}
		public bool deactivateLightsensor()
		{
			return _simulator.DeactivateLightSensor();
		}
		public double measureWeight()
		{
			return _simulator.MeasureWeight();
		}
		public bool startConveyer(int speed)
		{
			return _simulator.StartConveyer();
		}
		public bool stopConveyer()
		{
			return _simulator.StopConveyer();
		}
		public bool defineVector(char group, string vectorName, short size)
		{
			return true;
		}
		public bool teach(string vectorName, Vector vector)
	    {
	    	return true;
	    }
		public bool enterManualMode(short moveType)
	    {
	    	return true;
	    }
		public bool closeManualMode()
	    {
	    	return true;
	    }
		public bool stopRobot(char axis)
	    {
	    	return true;
	    }
		public bool isEmergency()
		{
			return false;
		}
		public bool isRobotOnline()
		{
			return true;
		}
        public void closeConnection()
        {
        	_simulator.CloseConnection();
        }

        #region IControllerCommunication Members

        public void WatchMotions(bool endMotions, bool startMotions)
        {
            
        }

        #endregion
    }
}
